namespace AtomicCms.Tests.Controllers
{
    using System;
    using System.Web.Mvc;
    using System.Web.Routing;
    using Moq;
    using NUnit.Framework;
    using Services.Abstract;
    using Web.Controllers;

    [TestFixture]
    public class ToolsControllerBehavior
    {
        [Test]
        public void Should_create_alias_by_title()
        {
            var pageServiceMoq = new Mock<IPageService>();
            ToolsController controller = new ToolsController(pageServiceMoq.Object, null, null);
            JsonResult aliasResult = controller.CreateAlias("This is my 1'st title.", "alex");
            Assert.IsNotNull(aliasResult);
            RouteValueDictionary typed = new RouteValueDictionary(aliasResult.Data);
            Assert.AreEqual("this-title", typed["alias"]);
        }
    }
}